/*
 * Customers.h
 *
 *	Customers set description
 *
 *  Created on: 2011-10-30
 *      Author: mateusz
 */

#include "Customer.h"
#include <vector>
#include <stdexcept>
#include <algorithm>
#include <utility>
#include <set>

#ifndef CUSTOMERS_H_
#define CUSTOMERS_H_

//using namespace std;

extern const int INFTY;

class Customers {
public:
	Customers();
	virtual ~Customers();

	void addCustomer(int id, double x, double y, int demand);
	int getTotalCustomers();
	int getTotalUnvisitedCustomers();

	Customer* getCustomer(int id);
	int getCustomerInputId(int id);
	Customer* getNextUnvisited(int startFrom, int maxDemand);

	void visitCustomer(int id);
	void unvisitCustomer(int id);

	double getDepotDistance(int id);

	void preprocessing();

	double getMinVertexDistance();
	double getDepotDistancesLeft();
	double getMinEdgesLeft();
	int getTotalDemandLeft();

private:
	std::vector<Customer*> customers;	// container of all customers
	std::vector<Customer*>::iterator it;
	std::set<std::pair<double, int> > minVertexDistances;	// set containing min neighbor distances from each unvisited customer
	std::set<std::pair<double, int> >::iterator sit;
	int unvisitedCount;	// number of unvisited customers
	double depotDistancesLeft;	// sum of all unvisited customers depot distances
	double minEdgesLeft;	// sum of all unvisited customers min incident edges (min neighbor distance)
	int totalDemandLeft;	// sum of demands of all unvisited customers
};

#endif /* CUSTOMERS_H_ */
